#!/bin/bash

# clean case and gen mesh
foamCleanTutorials

blockMesh

decomposePar

mpirun -np 4 renumberMesh -overwrite       

# run solver
mpirun -np 4 pimpleFoam -parallel | tee log.pimpleFoam

# clean sixDoF data
file='postProcessing/sixDoFRigidBodyState/0/sixDoFRigidBodyState.dat'
cp ${file} clean.dat
file='clean.dat'

sed -i "s/(//g" ${file}
sed -i "s/)//g" ${file}
sed -i '/#/'d ${file}